//
//  BasePageCollectionViewCell.m
//  SleepApp
//
//  Created by MAC on 2021/3/27.
//  Copyright © 2021 RiceWang. All rights reserved.
//

#import "BasePageCollectionViewCell.h"


#pragma mark -- BasePageViewController 的内容cell
@interface BasePageCollectionViewCell (){
    WLNavigationScrollModel *_model;
}
@property(nonatomic,strong) UIView *showView;
@end
@implementation BasePageCollectionViewCell
-(void)bind_row_data:(WLBaseCollectionViewLayerRow *)sender{
    if ([sender.data isKindOfClass:WLNavigationScrollModel.class]){
        _model = sender.data;
        if (_model.contentClass){
            if (!self.showView){
                self.showView = [[_model.contentClass alloc]init];
                [self addSubview:self.showView];
                [self.showView mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.edges.insets(UIEdgeInsetsZero);
                }];
                [self performSelector:@selector(beginRefreshData) withObject:@"beginRefreshData" afterDelay:.05f];
            }
        }
    }
}
-(void)bind_delegate:(id)sender{
    
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = UIColor.clearColor;
    }
    return self;
}
/** 开始数据刷新*/
-(void)beginRefreshData{
    if (self.showView){
        //绑定的次方法由实现的contenView 实现
        [self.showView wl_classMethod:@selector(beginRefreshData:) object:_model];
    }
}
/** 当前cell展示的时候 的 回调更新 会默认调用子对象中的 navigationContentCellShow 方法，声明重写即可*/
-(void)navigationContentCellShow{
    if (self.showView){
        //绑定的次方法由实现的contenView 实现
        [self.showView wl_classMethod:@selector(navigationContentCellShow:) object:_model];
    }
}
@end
